"""
    定义对象计数器，
    定义老婆类，创建3个老婆对象
    可以通过类变量纪录老婆对象个数，
    可以通过类方法打印老婆对象个数
"""

class Wife:
    count = 0
    # 类的数据成员
    def __init__(self, name, age):
      self.name = name
      self.age = age
      Wife.count += 1
    
    # 类的方法，可以通过类方法打印老婆对象个数
    @classmethod
    def print_wife(cls):
      print(f"创建了{Wife.count}个老婆")
      
li = Wife("老婆","18")
li1 = Wife("老婆1","18")
li2 = Wife("老婆2","18")

Wife.print_wife()   


